<?php

/**
 * JingYao-backend
 *
 * @link     https://gitee.com/wang-zhihui-release/jingyao-backend
 * @apiDocument https://gitee.com/wang-zhihui-release/jingyao-backend/wikis/
 */

namespace App\Exports;

use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
use Maatwebsite\Excel\Concerns\WithStrictNullComparison;

class TablesExport implements FromCollection, WithStrictNullComparison, WithColumnFormatting
{
    /**
     * @var \Illuminate\Support\Collection
     */
    private $data;

    private $columnFormat;

    /**
     * TablesExport constructor.
     *
     * @param mixed $data
     * @param array $columnFormat
     */
    public function __construct($data, $columnFormat = [])
    {
        $this->data = $data;
        $this->columnFormat = $columnFormat;
    }

    /**
     * @return \Illuminate\Support\Collection
     */
    public function collection()
    {
        return $this->data;
    }

    public function columnFormats(): array
    {
        return $this->columnFormat;
    }
}
